<!DOCTYPE html>
<html>
<head>
    <#include "../../common/head.ftl">
    <script type="text/javascript">
        function delfunc(obj) {
            layer.confirm('确认删除？', {
                    btn: ['确定', '取消'] //按钮
                }, function () {
                    $.ajax({
                        type: 'post',
                        url: $(obj).attr('data-url'),
                        data: {act: 'del', del_id: $(obj).attr('data-id')},
                        dataType: 'json',
                        success: function (data) {
                            if (data == 1) {
                                layer.msg('操作成功', {icon: 1});
                                $(obj).parent().parent().remove();
                            } else {
                                layer.msg(data, {icon: 2, time: 2000});
                            }
                            layer.closeAll();
                        }
                    })
                }, function (index) {
                    layer.close(index);
                    return false;// 取消
                }
            );
        }

        //全选
        function selectAll(name, obj) {
            $('input[name*=' + name + ']').prop('checked', $(obj).checked);
        }

        function get_help(obj) {
            layer.open({
                type: 2,
                title: '帮助手册',
                shadeClose: true,
                shade: 0.3,
                area: ['90%', '90%'],
                content: $(obj).attr('data-url'),
            });
        }

        function delAll(obj, name) {
            var a = [];
            $('input[name*=' + name + ']').each(function (i, o) {
                if ($(o).is(':checked')) {
                    a.push($(o).val());
                }
            })
            if (a.length == 0) {
                layer.alert('请选择删除项', {icon: 2});
                return;
            }
            layer.confirm('确认删除？', {btn: ['确定', '取消']}, function () {
                    $.ajax({
                        type: 'get',
                        url: $(obj).attr('data-url'),
                        data: {act: 'del', del_id: a},
                        dataType: 'json',
                        success: function (data) {
                            if (data == 1) {
                                layer.msg('操作成功', {icon: 1});
                                $('input[name*=' + name + ']').each(function (i, o) {
                                    if ($(o).is(':checked')) {
                                        $(o).parent().parent().remove();
                                    }
                                })
                            } else {
                                layer.msg(data, {icon: 2, time: 2000});
                            }
                            layer.closeAll();
                        }
                    })
                }, function (index) {
                    layer.close(index);
                    return false;// 取消
                }
            );
        }
    </script>
    <meta name="__hash__" content="4037ad1a4e0f20cca3fa62b7b63d1b09_61e765ad01e1c1ae2ba09e242be5cc5e"/>
</head>
<body style="background-color:#ecf0f5;">


<div class="wrapper">
    <div class="breadcrumbs" id="breadcrumbs">
        <ol class="breadcrumb">
            <li><a href="javascript:void();"><i class="fa fa-home"></i>&nbsp;&nbsp;后台首页</a></li>

            <li><a href="javascript:void();">商品管理</a></li>
            <li><a href="javascript:void();">商品品牌</a></li>
        </ol>
    </div>

    <section class="content">
        <div class="container-fluid">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-list"></i> 品牌列表</h3>
                </div>
                <div class="panel-body">
                    <div class="navbar navbar-default">
                        <form id="search-form2" class="navbar-form form-inline" method="post"
                              action="/index/Admin/Goods/brandList">
                            <div class="form-group">
                                <label for="input-order-id" class="control-label">名称:</label>
                                <div class="input-group">
                                    <input type="text" class="form-control" id="input-order-id" placeholder="搜索词"
                                           value="" name="keyword">
                                </div>
                            </div>
                            <div class="form-group">
                                <button class="btn btn-primary" id="button-filter search-order" type="submit"><i
                                            class="fa fa-search"></i> 筛选
                                </button>
                            </div>
                            <button type="button" class="btn btn-primary pull-right"
                                    onclick="location.href='品牌列表-添加品牌.html'">
                                <i class="fa fa-plus"></i> 添加品牌
                            </button>
                            <input type="hidden" name="__hash__"
                                   value="4037ad1a4e0f20cca3fa62b7b63d1b09_61e765ad01e1c1ae2ba09e242be5cc5e"/></form>
                    </div>

                    <div id="ajax_return">

                        <div class="table-responsive">
                            <table class="table table-bordered table-hover">
                                <thead>
                                <tr>
                                    <th class="sorting text-left">ID</th>
                                    <th class="sorting text-left">品牌名称</th>
                                    <th class="sorting text-left">Logo</th>
                                    <th class="sorting text-left">品牌分类</th>
                                    <th valign="middle">是否推荐</th>
                                    <th class="sorting text-left">排序</th>
                                    <th class="sorting text-left">操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr>
                                    <td class="text-right">1</td>
                                    <td class="text-left">华为/HUAWEI</td>
                                    <td class="text-left">
                                        <a href="../Public/upload/brand/2016/04-01/1584936.jpg" target="_blank"><img
                                                    onmouseover="$(this).attr('width','80').attr('height','45');"
                                                    onmouseout="$(this).attr('width','40').attr('height','30');"
                                                    width="40" height="30"
                                                    src="../Public/upload/brand/2016/04-01/1584936.jpg"/></a>
                                    </td>
                                    <td class="text-left">手机 、 数码 、 通信</td>
                                    <td>
                                        <img width="20" height="20" src="../Public/images/cancel.png"
                                             onclick="changeTableVal('brand','id','1','is_hot',this)"/>
                                    </td>
                                    <td class="text-left">
                                        <input type="text" onchange="updateSort('brand','id','1','sort',this)"
                                               onkeyup="this.value=this.value.replace(/[^\d]/g,'')"
                                               onpaste="this.value=this.value.replace(/[^\d]/g,'')" size="4" value="50"
                                               class="input-sm"/>
                                    </td>
                                    <td class="text-left">
                                        <a href="品牌列表-添加品牌.html" data-toggle="tooltip" title="" class="btn btn-primary"
                                           data-original-title="编辑"><i class="fa fa-pencil"></i></a>
                                        <a href="javascript:void(0);" onclick="del('1')" id="button-delete6"
                                           data-toggle="tooltip" title="" class="btn btn-danger"
                                           data-original-title="删除"><i class="fa fa-trash-o"></i></a>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="text-right">2</td>
                                    <td class="text-left">摩托罗拉/MOTOROLA</td>
                                    <td class="text-left">
                                        <a href="../Public/upload/brand/2016/04-01/2309646.jpg" target="_blank"><img
                                                    onmouseover="$(this).attr('width','80').attr('height','45');"
                                                    onmouseout="$(this).attr('width','40').attr('height','30');"
                                                    width="40" height="30"
                                                    src="../Public/upload/brand/2016/04-01/2309646.jpg"/></a>
                                    </td>
                                    <td class="text-left">手机 、 数码 、 通信 手机 、 数码 、 通信</td>
                                    <td>
                                        <img width="20" height="20" src="../Public/images/cancel.png"
                                             onclick="changeTableVal('brand','id','2','is_hot',this)"/>
                                    </td>
                                    <td class="text-left">
                                        <input type="text" onchange="updateSort('brand','id','2','sort',this)"
                                               onkeyup="this.value=this.value.replace(/[^\d]/g,'')"
                                               onpaste="this.value=this.value.replace(/[^\d]/g,'')" size="4" value="50"
                                               class="input-sm"/>
                                    </td>
                                    <td class="text-left">
                                        <a href="/index/Admin/goods/addEditBrand/id/2" data-toggle="tooltip" title=""
                                           class="btn btn-primary" data-original-title="编辑"><i class="fa fa-pencil"></i></a>
                                        <a href="javascript:void(0);" onclick="del('2')" id="button-delete6"
                                           data-toggle="tooltip" title="" class="btn btn-danger"
                                           data-original-title="删除"><i class="fa fa-trash-o"></i></a>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="text-right">3</td>
                                    <td class="text-left">小辣椒</td>
                                    <td class="text-left">
                                        <a href="../Public/upload/brand/2016/04-01/3213983.jpg" target="_blank"><img
                                                    onmouseover="$(this).attr('width','80').attr('height','45');"
                                                    onmouseout="$(this).attr('width','40').attr('height','30');"
                                                    width="40" height="30"
                                                    src="../Public/upload/brand/2016/04-01/3213983.jpg"/></a>
                                    </td>
                                    <td class="text-left">手机 、 数码 、 通信 手机 、 数码 、 通信</td>
                                    <td>
                                        <img width="20" height="20" src="../Public/images/cancel.png"
                                             onclick="changeTableVal('brand','id','3','is_hot',this)"/>
                                    </td>
                                    <td class="text-left">
                                        <input type="text" onchange="updateSort('brand','id','3','sort',this)"
                                               onkeyup="this.value=this.value.replace(/[^\d]/g,'')"
                                               onpaste="this.value=this.value.replace(/[^\d]/g,'')" size="4" value="50"
                                               class="input-sm"/>
                                    </td>
                                    <td class="text-left">
                                        <a href="/index/Admin/goods/addEditBrand/id/3" data-toggle="tooltip" title=""
                                           class="btn btn-primary" data-original-title="编辑"><i class="fa fa-pencil"></i></a>
                                        <a href="javascript:void(0);" onclick="del('3')" id="button-delete6"
                                           data-toggle="tooltip" title="" class="btn btn-danger"
                                           data-original-title="删除"><i class="fa fa-trash-o"></i></a>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="text-right">4</td>
                                    <td class="text-left">索尼/SONY</td>
                                    <td class="text-left">
                                        <a href="../Public/upload/brand/2016/04-01/4178854.jpg" target="_blank"><img
                                                    onmouseover="$(this).attr('width','80').attr('height','45');"
                                                    onmouseout="$(this).attr('width','40').attr('height','30');"
                                                    width="40" height="30"
                                                    src="../Public/upload/brand/2016/04-01/4178854.jpg"/></a>
                                    </td>
                                    <td class="text-left">手机 、 数码 、 通信 手机 、 数码 、 通信</td>
                                    <td>
                                        <img width="20" height="20" src="../Public/images/cancel.png"
                                             onclick="changeTableVal('brand','id','4','is_hot',this)"/>
                                    </td>
                                    <td class="text-left">
                                        <input type="text" onchange="updateSort('brand','id','4','sort',this)"
                                               onkeyup="this.value=this.value.replace(/[^\d]/g,'')"
                                               onpaste="this.value=this.value.replace(/[^\d]/g,'')" size="4" value="50"
                                               class="input-sm"/>
                                    </td>
                                    <td class="text-left">
                                        <a href="/index/Admin/goods/addEditBrand/id/4" data-toggle="tooltip" title=""
                                           class="btn btn-primary" data-original-title="编辑"><i class="fa fa-pencil"></i></a>
                                        <a href="javascript:void(0);" onclick="del('4')" id="button-delete6"
                                           data-toggle="tooltip" title="" class="btn btn-danger"
                                           data-original-title="删除"><i class="fa fa-trash-o"></i></a>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="text-right">5</td>
                                    <td class="text-left">诺基亚/NOKIA</td>
                                    <td class="text-left">
                                        <a href="../Public/upload/brand/2016/04-01/5498254.jpg" target="_blank"><img
                                                    onmouseover="$(this).attr('width','80').attr('height','45');"
                                                    onmouseout="$(this).attr('width','40').attr('height','30');"
                                                    width="40" height="30"
                                                    src="../Public/upload/brand/2016/04-01/5498254.jpg"/></a>
                                    </td>
                                    <td class="text-left">手机 、 数码 、 通信 手机 、 数码 、 通信</td>
                                    <td>
                                        <img width="20" height="20" src="../Public/images/cancel.png"
                                             onclick="changeTableVal('brand','id','5','is_hot',this)"/>
                                    </td>
                                    <td class="text-left">
                                        <input type="text" onchange="updateSort('brand','id','5','sort',this)"
                                               onkeyup="this.value=this.value.replace(/[^\d]/g,'')"
                                               onpaste="this.value=this.value.replace(/[^\d]/g,'')" size="4" value="50"
                                               class="input-sm"/>
                                    </td>
                                    <td class="text-left">
                                        <a href="/index/Admin/goods/addEditBrand/id/5" data-toggle="tooltip" title=""
                                           class="btn btn-primary" data-original-title="编辑"><i class="fa fa-pencil"></i></a>
                                        <a href="javascript:void(0);" onclick="del('5')" id="button-delete6"
                                           data-toggle="tooltip" title="" class="btn btn-danger"
                                           data-original-title="删除"><i class="fa fa-trash-o"></i></a>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="text-right">6</td>
                                    <td class="text-left">TCL</td>
                                    <td class="text-left">
                                        <a href="../Public/upload/brand/2016/04-01/6592544.jpg" target="_blank"><img
                                                    onmouseover="$(this).attr('width','80').attr('height','45');"
                                                    onmouseout="$(this).attr('width','40').attr('height','30');"
                                                    width="40" height="30"
                                                    src="../Public/upload/brand/2016/04-01/6592544.jpg"/></a>
                                    </td>
                                    <td class="text-left">手机 、 数码 、 通信 手机 、 数码 、 通信</td>
                                    <td>
                                        <img width="20" height="20" src="../Public/images/cancel.png"
                                             onclick="changeTableVal('brand','id','6','is_hot',this)"/>
                                    </td>
                                    <td class="text-left">
                                        <input type="text" onchange="updateSort('brand','id','6','sort',this)"
                                               onkeyup="this.value=this.value.replace(/[^\d]/g,'')"
                                               onpaste="this.value=this.value.replace(/[^\d]/g,'')" size="4" value="50"
                                               class="input-sm"/>
                                    </td>
                                    <td class="text-left">
                                        <a href="/index/Admin/goods/addEditBrand/id/6" data-toggle="tooltip" title=""
                                           class="btn btn-primary" data-original-title="编辑"><i class="fa fa-pencil"></i></a>
                                        <a href="javascript:void(0);" onclick="del('6')" id="button-delete6"
                                           data-toggle="tooltip" title="" class="btn btn-danger"
                                           data-original-title="删除"><i class="fa fa-trash-o"></i></a>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="text-right">7</td>
                                    <td class="text-left">飞利浦/PHILIPS</td>
                                    <td class="text-left">
                                        <a href="../Public/upload/brand/2016/04-01/7956109.jpg" target="_blank"><img
                                                    onmouseover="$(this).attr('width','80').attr('height','45');"
                                                    onmouseout="$(this).attr('width','40').attr('height','30');"
                                                    width="40" height="30"
                                                    src="../Public/upload/brand/2016/04-01/7956109.jpg"/></a>
                                    </td>
                                    <td class="text-left">手机 、 数码 、 通信 手机 、 数码 、 通信</td>
                                    <td>
                                        <img width="20" height="20" src="../Public/images/cancel.png"
                                             onclick="changeTableVal('brand','id','7','is_hot',this)"/>
                                    </td>
                                    <td class="text-left">
                                        <input type="text" onchange="updateSort('brand','id','7','sort',this)"
                                               onkeyup="this.value=this.value.replace(/[^\d]/g,'')"
                                               onpaste="this.value=this.value.replace(/[^\d]/g,'')" size="4" value="50"
                                               class="input-sm"/>
                                    </td>
                                    <td class="text-left">
                                        <a href="/index/Admin/goods/addEditBrand/id/7" data-toggle="tooltip" title=""
                                           class="btn btn-primary" data-original-title="编辑"><i class="fa fa-pencil"></i></a>
                                        <a href="javascript:void(0);" onclick="del('7')" id="button-delete6"
                                           data-toggle="tooltip" title="" class="btn btn-danger"
                                           data-original-title="删除"><i class="fa fa-trash-o"></i></a>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="text-right">8</td>
                                    <td class="text-left">OPPO</td>
                                    <td class="text-left">
                                        <a href="../Public/upload/brand/2016/04-01/8351889.jpg" target="_blank"><img
                                                    onmouseover="$(this).attr('width','80').attr('height','45');"
                                                    onmouseout="$(this).attr('width','40').attr('height','30');"
                                                    width="40" height="30"
                                                    src="../Public/upload/brand/2016/04-01/8351889.jpg"/></a>
                                    </td>
                                    <td class="text-left">手机 、 数码 、 通信 手机 、 数码 、 通信</td>
                                    <td>
                                        <img width="20" height="20" src="../Public/images/cancel.png"
                                             onclick="changeTableVal('brand','id','8','is_hot',this)"/>
                                    </td>
                                    <td class="text-left">
                                        <input type="text" onchange="updateSort('brand','id','8','sort',this)"
                                               onkeyup="this.value=this.value.replace(/[^\d]/g,'')"
                                               onpaste="this.value=this.value.replace(/[^\d]/g,'')" size="4" value="50"
                                               class="input-sm"/>
                                    </td>
                                    <td class="text-left">
                                        <a href="/index/Admin/goods/addEditBrand/id/8" data-toggle="tooltip" title=""
                                           class="btn btn-primary" data-original-title="编辑"><i class="fa fa-pencil"></i></a>
                                        <a href="javascript:void(0);" onclick="del('8')" id="button-delete6"
                                           data-toggle="tooltip" title="" class="btn btn-danger"
                                           data-original-title="删除"><i class="fa fa-trash-o"></i></a>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="text-right">9</td>
                                    <td class="text-left">苹果/Apple</td>
                                    <td class="text-left">
                                        <a href="../Public/upload/brand/2016/04-01/9515283.jpg" target="_blank"><img
                                                    onmouseover="$(this).attr('width','80').attr('height','45');"
                                                    onmouseout="$(this).attr('width','40').attr('height','30');"
                                                    width="40" height="30"
                                                    src="../Public/upload/brand/2016/04-01/9515283.jpg"/></a>
                                    </td>
                                    <td class="text-left">手机 、 数码 、 通信 手机 、 数码 、 通信</td>
                                    <td>
                                        <img width="20" height="20" src="../Public/images/cancel.png"
                                             onclick="changeTableVal('brand','id','9','is_hot',this)"/>
                                    </td>
                                    <td class="text-left">
                                        <input type="text" onchange="updateSort('brand','id','9','sort',this)"
                                               onkeyup="this.value=this.value.replace(/[^\d]/g,'')"
                                               onpaste="this.value=this.value.replace(/[^\d]/g,'')" size="4" value="50"
                                               class="input-sm"/>
                                    </td>
                                    <td class="text-left">
                                        <a href="/index/Admin/goods/addEditBrand/id/9" data-toggle="tooltip" title=""
                                           class="btn btn-primary" data-original-title="编辑"><i class="fa fa-pencil"></i></a>
                                        <a href="javascript:void(0);" onclick="del('9')" id="button-delete6"
                                           data-toggle="tooltip" title="" class="btn btn-danger"
                                           data-original-title="删除"><i class="fa fa-trash-o"></i></a>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="text-right">10</td>
                                    <td class="text-left">HTC</td>
                                    <td class="text-left">
                                        <a href="../Public/upload/brand/2016/04-01/10479934.jpg" target="_blank"><img
                                                    onmouseover="$(this).attr('width','80').attr('height','45');"
                                                    onmouseout="$(this).attr('width','40').attr('height','30');"
                                                    width="40" height="30"
                                                    src="../Public/upload/brand/2016/04-01/10479934.jpg"/></a>
                                    </td>
                                    <td class="text-left">手机 、 数码 、 通信 手机 、 数码 、 通信</td>
                                    <td>
                                        <img width="20" height="20" src="../Public/images/cancel.png"
                                             onclick="changeTableVal('brand','id','10','is_hot',this)"/>
                                    </td>
                                    <td class="text-left">
                                        <input type="text" onchange="updateSort('brand','id','10','sort',this)"
                                               onkeyup="this.value=this.value.replace(/[^\d]/g,'')"
                                               onpaste="this.value=this.value.replace(/[^\d]/g,'')" size="4" value="50"
                                               class="input-sm"/>
                                    </td>
                                    <td class="text-left">
                                        <a href="/index/Admin/goods/addEditBrand/id/10" data-toggle="tooltip" title=""
                                           class="btn btn-primary" data-original-title="编辑"><i class="fa fa-pencil"></i></a>
                                        <a href="javascript:void(0);" onclick="del('10')" id="button-delete6"
                                           data-toggle="tooltip" title="" class="btn btn-danger"
                                           data-original-title="删除"><i class="fa fa-trash-o"></i></a>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </div>

                        <div class="row">
                            <div class="col-sm-6 text-left"></div>
                            <div class="col-sm-6 text-right">
                                <div class='dataTables_paginate paging_simple_numbers'>
                                    <ul class='pagination'>
                                        <li class="paginate_button active"><a tabindex="0" data-dt-idx="1"
                                                                              aria-controls="example1" href="#">1</a>
                                        </li>
                                        <li class="paginate_button"><a class="num"
                                                                       href="/index/Admin/Goods/brandList/p/2">2</a>
                                        </li>
                                        <li class="paginate_button"><a class="num"
                                                                       href="/index/Admin/Goods/brandList/p/3">3</a>
                                        </li>
                                        <li class="paginate_button"><a class="num"
                                                                       href="/index/Admin/Goods/brandList/p/4">4</a>
                                        </li>
                                        <li class="paginate_button"><a class="num"
                                                                       href="/index/Admin/Goods/brandList/p/5">5</a>
                                        </li>
                                        <li class="paginate_button"><a class="num"
                                                                       href="/index/Admin/Goods/brandList/p/6">6</a>
                                        </li>
                                        <li class="paginate_button"><a class="num"
                                                                       href="/index/Admin/Goods/brandList/p/7">7</a>
                                        </li>
                                        <li class="paginate_button"><a class="num"
                                                                       href="/index/Admin/Goods/brandList/p/8">8</a>
                                        </li>
                                        <li class="paginate_button"><a class="num"
                                                                       href="/index/Admin/Goods/brandList/p/9">9</a>
                                        </li>
                                        <li class="paginate_button"><a class="num"
                                                                       href="/index/Admin/Goods/brandList/p/10">10</a>
                                        </li>
                                        <li class="paginate_button"><a class="num"
                                                                       href="/index/Admin/Goods/brandList/p/11">11</a>
                                        </li>
                                        <li id="example1_next" class="paginate_button next"><a class="next"
                                                                                               href="/index/Admin/Goods/brandList/p/2">下一页</a>
                                        </li>
                                        <li id="example1_previous" class="paginate_button previous disabled"><a
                                                    class="end" href="/index/Admin/Goods/brandList/p/35">尾页</a></li>
                                    </ul>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
        <!-- /.row -->
    </section>
    <!-- /.content -->
</div>
<!-- /.content-wrapper -->
<script>
    // 删除操作
    function del(id) {
        if (!confirm('确定要删除吗?'))
            return false;
        $.ajax({
            url: "/index?m=Admin&c=goods&a=delBrand&id=" + id,
            success: function (v) {
                var v = eval('(' + v + ')');
                if (v.hasOwnProperty('status') && (v.status == 1))
                    location.href = '/index/Admin/goods/brandList';
                else
                    layer.msg(v.msg, {icon: 2, time: 1000}); //alert(v.msg);
            }
        });
        return false;
    }


    //修改指定表的指定字段值
    function changeBrandField(field, id, obj) {

        var isshow = $(obj).data('isshow');
        if (isshow == 1) {
            $(obj).data('isshow', '0');
            var value = 0;
            $(obj).attr('src', '../Public/images/cancel.png');

        } else {
            $(obj).data('isshow', '1');
            var value = 1;
            $(obj).attr('src', '../Public/images/yes.png');
        }

        $.ajax({
            url: '/index?m=Admin&c=goods&a=changeBrandField&field=' + field + '&id=' + id + '&value=' + value,
            success: function (data) {
                //
            }
        });

    }
</script>
</body>
</html>